﻿<%@ Page Title="ScrumPeak.com" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
  AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage<Peak.Web.Controllers.Models.SprintsModel>" %>
<%@ Import Namespace="Peak.Web.Controllers.Models"%>
<%@ Import Namespace="Peak.Web.Controllers.HtmlExtentions"%>
<%@ Import Namespace="System.Threading"%>

<%@ Import Namespace="Peak.Web.Controllers" %>
<%@ Import Namespace="Peak.Core" %>
<%@ Import Namespace="Peak.Resources" %>
<%@ Import Namespace="Peak.ApplicationServices" %>
<asp:Content ContentPlaceHolderID="center" runat="server">
  <div class="page-title">
    <%= PageTitles.Sprints %></div>
  <div class="page-content">
    <table class="form">
      <tbody>
        <tr>
          <td align="right">
            <%= Labels.AvgRealVelocity %>
          </td>
          <td>
            <%= Model.AvgRealVelocity %>
          </td>
        </tr>                
      </tbody>
    </table>
  
    <%= Html.PeakButton<SprintController>(f => f.New(), Buttons.AddNew)%>
    <table class="table">
      <thead>
        <tr>
          <th>
            <%= Columns.Name %>
          </th> 
          <th class="autoWidthColumn">
            <%= Columns.Status %>
          </th>   
          <th class="autoWidthColumn">
            <%= Columns.RemainingEffort %>
          </th>                                       
          <th class="autoWidthColumn">
            <%= Columns.EstimatedVelocity %>
          </th>                                       
          <th class="autoWidthColumn">
            <%= Columns.RealVelocity %>
          </th> 
          <th class="autoWidthColumn">
            <%= Columns.Duration %>
          </th>                                       
        </tr>
      </thead>
      <tbody>
        <% foreach (SprintModel sprint in Model.Sprints)
           {%>
        <tr>
          <td>
            <% if (sprint.Status != SprintStatus.Finished)
               { %>
               <%= Html.ActionLink<SprintController>(f => f.Index(sprint.SprintId), sprint.Name + " (" + Labels.CurrentSprint + ")", new { @class = "currentSprint" })%>               
            <% }
               else
               { %>
               <%= Html.ActionLink<SprintController>(f => f.Index(sprint.SprintId), sprint.Name)%>
            <% } %>
            <%= Html.Delete<SprintsController>(f => f.Remove(sprint.SprintId))%>
            <%= Html.Edit<SprintController>(f => f.Edit(sprint.SprintId))%>                                    
          </td> 
          <td>
            <%= sprint.Status %>
          </td> 
          <td align="center">
            <%= DurationParser.ToString(sprint.RemainingEffort) %>
          </td>                   
          <td align="center">
            <%= sprint.EstimatedVelocity %>
          </td> 
          <td align="center">
            <%= sprint.RealVelocity %>
          </td> 
          <td align="center">
            <%= sprint.Days %>
          </td>                   
        </tr>
        <% } %>
        <% if (Model.Sprints.Count == 0)
           {%>
        <tr>
          <td colspan="12">
             <%= Messages.NoResults %>
          </td>                       
        </tr> 
        <%
           }%>
      </tbody>
    </table>
  </div>
</asp:Content>
